import 'dart:convert';

class UserInfo {
  final String nickname;
  final List<String> identityTags;
  final String? description;

  UserInfo({
    required this.nickname,
    required this.identityTags,
    this.description,
  });

  factory UserInfo.fromJson(Map<String, dynamic> json) {
    return UserInfo(
      nickname: json['nickname'] ?? '',
      identityTags: (json['identity_tag'] != null) 
          ? List<String>.from(json['identity_tag']) 
          : [],
      description: json['description'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'nickname': nickname,
      'identity_tag': identityTags,
      'description': description,
    };
  }

  UserInfo copyWith({
    String? nickname,
    List<String>? identityTags,
    String? description,
  }) {
    return UserInfo(
      nickname: nickname ?? this.nickname,
      identityTags: identityTags ?? this.identityTags,
      description: description ?? this.description,
    );
  }
} 